package com.aaa.sso.controller;

import com.aaa.common.util.Result;
import com.aaa.sso.service.AuthService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * fileName:MemberLoginController
 * description: cm = check member 检查会员是否认证
 * author: znb
 * createTime:2020/12/7 0007 09:34
 * version:1.0.0
 */
@RestController
@RequestMapping("memberLogin")
@SuppressWarnings("all")
public class MemberLoginController {


    private Logger logger = LoggerFactory.getLogger(MemberLoginController.class);
    //@Resource(name = "memberAuthService")
    @Autowired
    @Qualifier("memberAuthService")
    private AuthService authService;



    /**
     * 会员验证功能
     * @param userName
     * @param passWord
     * @return
     */
    @GetMapping("authMember")
    public Result authMemberOrUser( String userName, String passWord){
        logger.info(userName+","+passWord+"........userName.......");
      //  System.out.println();
        return authService.authMemberOrUser(userName,passWord);
    }

    /**
     * 验证Token
     * @param accessToken
     * @return
     */
    @GetMapping("checkAccessToken")
    public boolean checkAccessToken(@RequestParam("accessToken")String accessToken){
        return authService.checkAccessToken(accessToken);
    }
}
